package com.zsrt.springboot.controller;


import javax.servlet.http.HttpServletRequest;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.zsrt.springboot.entity.Student;


@RestController
public class StudentController{
	
	
	/**
	 * http://localhost:8080/student?id=1010
	 * @param id
	 * @param request
	 * @return
	 */
	@RequestMapping(value="/student",method=RequestMethod.GET,produces=MediaType.APPLICATION_JSON_VALUE)
	public Student findById(Integer id,HttpServletRequest request){
		
		Student student = new Student();
		student.setId(id);
		student.setName("scott");
		student.setMessage(request.getRequestURL().toString());
		
		return student;
		
	}

}
